Skip to content

Conversation

@yingcai-cy
Copy link
Contributor

  • or expression
  • change negate return type form Result to Expression
  • add some tests

 - or expression
 - change negate return type form Result to Expression
 - add some tests
virtual Result<std::shared_ptr<Expression>> Negate() const {
return InvalidExpression("Expression cannot be negated");
virtual std::shared_ptr<Expression> Negate() const {
throw IcebergError("Expression cannot be negated");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing the return type? We need to stick to Result instead of exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s been a couple of days, let me recall. I believe the reason is that all expression implementations have a corresponding Negate form, so none of them would return incorrect results in this context.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything can be negated in theory, and this is also the case in practice.

virtual Result<std::shared_ptr<Expression>> Negate() const {
return InvalidExpression("Expression cannot be negated");
virtual std::shared_ptr<Expression> Negate() const {
throw IcebergError("Expression cannot be negated");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything can be negated in theory, and this is also the case in practice.

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@Fokko Fokko merged commit f2a79a1 into apache:main Jun 25, 2025
7 checks passed
@Fokko
Copy link
Contributor

Fokko commented Jun 25, 2025

Thanks @yingcai-cy for working on this, and @wgtmac for the review 🚀

lishuxu pushed a commit to lishuxu/iceberg-cpp that referenced this pull request Jul 5, 2025
- or expression
 - change negate return type form Result to Expression
 - add some tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants